<?php
$HOST = "127.0.0.1";;
$USER = "kawi";
$PASS = "";
$DB = "test";
//$conn = mysqli_connect($HOST,$USER,$PASS,$DB) or die(mysqli_connect_error());

//authenticateUser
function authenticateUser($username, $password){
//     $query = "SELECT * FROM users WHERE username='$username' AND password=SHA1('$password');";
//     $result = mysqli_query($GLOBALS['conn'], $query) or die(mysqli_error($GLOBALS['conn']));
//     if (mysqli_num_rows($result) == 1){
//         return mysqli_fetch_array($result);
//     }
	if ($username == "Hello" && $password == "Hello"){
		return True;
	}
    return False;
}
function authorizeUser($role, $requested_page){
    //should I put into database?
    $admin = array('/practice/manageUser.php', '/practice/managePatient.php', '/practice/adminHome.php', '/practice/index.php');
    $member = array('/practice/profile.php', '/practice/viewNotes.php', '/practice/index.php');
    $patient = array('/practice/profile.php', '/practice/viewNotes.php', '/practice/contactDoctor.php', '/practice/makeAppointment.php');
    $doctor = array('/practice/viewPatientDetails.php', '/practice/manageNotes.php', '/practice/profile.php');
    if ($role == 'doctor'){
        foreach ($doctor as $d){
            if ($requested_page == $d){
                return True;
            }
        }
    } else if ($role == 'member'){
        foreach ($member as $m){
            if ($requested_page == $m){
                return True;
            }
        }
    }else if ($role == 'patient'){
        foreach ($patient as $p){
            if ($requested_page == $p){
                return True;
            }
        }
    }else if ($role == 'admin'){
        foreach ($admin as $a){
            if ($requested_page == $a){
                return True;
            }
        }
    }
    return False;
}

//selectQuery($query)
//executeQuery($query)

?>